<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AlterDailyReportStatisticsAddIndexInformation extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('daily_report_statistics', function (Blueprint $table) {
            // 总会员数 今日注册会员数
            $table->unsignedInteger('total_number_of_before_agents')->default(0)->after('total_recharge_amount')->comment('当日前代理总数 (直接 T+1 统计, 不受任何条件影响)');
            // 订单量 大咖 精英 群主
            $table->unsignedInteger('number_of_group_owner_order')->default(0)->after('number_of_order')->comment('群主订单数 (直接 T+1 统计, 不受任何条件影响)');
            $table->unsignedInteger('number_of_elite_order')->default(0)->after('number_of_group_owner_order')->comment('精英订单数 (直接 T+1 统计, 不受任何条件影响)');
            $table->unsignedInteger('number_of_strongman_order')->default(0)->after('number_of_elite_order')->comment('大咖订单数 (直接 T+1 统计, 不受任何条件影响)');
            // 下单会员数 大咖 精英 群主
            $table->unsignedInteger('number_of_group_owner_place_order')->default(0)->after('number_of_strongman_order')->comment('下单群主人数 (直接 T+1 统计, 不受任何条件影响)');
            $table->unsignedInteger('number_of_elite_place_order')->default(0)->after('number_of_group_owner_place_order')->comment('下单精英人数 (直接 T+1 统计, 不受任何条件影响)');
            $table->unsignedInteger('number_of_strongman_place_order')->default(0)->after('number_of_elite_place_order')->comment('下单大咖人数 (直接 T+1 统计, 不受任何条件影响)');
            // 销售额 大咖 精英 群主
            $table->unsignedBigInteger('group_owner_performance_summary')->default(0)->after('number_of_strongman_place_order')->comment('群主销售额 (直接 T+1 统计, 不受任何条件影响)');
            $table->unsignedBigInteger('elite_performance_summary')->default(0)->after('group_owner_performance_summary')->comment('精英销售额 (直接 T+1 统计, 不受任何条件影响)');
            $table->unsignedBigInteger('strongman_performance_summary')->default(0)->after('elite_performance_summary')->comment('大咖销售额 (直接 T+1 统计, 不受任何条件影响)');
            // 活跃会员数 大咖 精英 群主
            $table->unsignedInteger('group_owner_uv')->default(0)->after('strongman_performance_summary')->comment('群主 uv (直接 T+1 统计, 不受任何条件影响)');
            $table->unsignedInteger('elite_uv')->default(0)->after('group_owner_uv')->comment('精英 uv (直接 T+1 统计, 不受任何条件影响)');
            $table->unsignedInteger('strongman_uv')->default(0)->after('elite_uv')->comment('大咖 uv (直接 T+1 统计, 不受任何条件影响)');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('daily_report_statistics', function (Blueprint $table) {
            $table->dropColumn('total_number_of_before_agents');
            $table->dropColumn('number_of_group_owner_order');
            $table->dropColumn('number_of_elite_order');
            $table->dropColumn('number_of_strongman_order');
            $table->dropColumn('number_of_group_owner_place_order');
            $table->dropColumn('number_of_elite_place_order');
            $table->dropColumn('number_of_strongman_place_order');
            $table->dropColumn('group_owner_performance_summary');
            $table->dropColumn('elite_performance_summary');
            $table->dropColumn('strongman_performance_summary');
            $table->dropColumn('group_owner_uv');
            $table->dropColumn('elite_uv');
            $table->dropColumn('strongman_uv');
        });
    }
}
